/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2021/12/6
 * \* Time: 20:41
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class TestDemo2 {

    public static void move(char pos1,char pos2){
        System.out.println(pos1+" -> "+pos2+" ");
    }
    public static void hanio(int n,char pos1,char pos2,char pos3){
        if (n==1){
            move(pos1,pos2);
        }else {
            hanio(n-1,pos1,pos3,pos2);
            move(pos1,pos3);
            hanio(n-1,pos2,pos1,pos3);
        }
    }
    public static void main(String[] args) {
        hanio(1,'A','B','C');
    }
}
